/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-04-14
 * Time: 17:57
 */
public class test3 {
    public int maxSubArray(int[] nums) {
        int n = nums.length;
        int ret = nums[0];
        int tmp = 0;
        for(int x:nums){
            tmp = Math.max(tmp,tmp+x);
            ret = Math.max(ret,tmp);
        }
        return ret;
    }
}
